CC = gcc
CFLAGS = -Wall -Wextra -Wno-implicit-fallthrough
LDFLAGS = -lm
SRC = webserver.c custom_handle.c cJSON.c
TARGET = server
HEADERS = webserver.h cJSON.h

.PHONY: all clean

all: $(TARGET)

$(TARGET): $(SRC) $(HEADERS)
	$(CC) $(CFLAGS) -o $@ $(filter %.c, $^) $(LDFLAGS)

clean:
	rm -f $(TARGET)

run: $(TARGET)
	./$(TARGET)